/* Yet Another Experimental Software Renderer
 *
 * Copyright (c) 2010 Pawel "Hery" Dziepak
 */

#include "pipeline.h"

namespace yaesr {
	class engine_state {
	public:
		enum eng_state {
			initialized,
			configuring,
			configured,
			standby,
			rendering,
			destroying
		};

		engine_state() : state(initialized) {}

		void change_status(eng_state new_state);
		bool is_status(eng_state s) {
			return s == state;
		}

	private:
		eng_state state;
	};

	class engine {
	public:
		template<typename T>
		T *get_input() {
			delete prev;

			prev = new T;
			pp->set_input(prev);

			return reinterpret_cast<T*>(prev);
		}

		void set_output(pixel_output *);
		void set_vertex_shader(vertex_shader *);
		void set_geometry_shader(geometry_shader *);
		void set_pixel_shader(pixel_shader *);

		void launch();

		engine();
	private:
		engine_state state;

		vertex_input *prev;
		pipeline *pp;
	};
}